package inherit;
/*
*人类
 */
public abstract class person {//属性
    private int age;//年龄
    private  String name;//姓名
public person(){
    System.out.println("我是person的构造方法");
}
    public person(int age, String name) {
        this.age = age;
        this.name = name;
    }
public void setAge(int age){//获取私有成员
    this.age=age;
}

    public void setName(String name) {//获取私有成员
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public String getName() {
        return name;
    }
//抽象方法
    public  abstract  void study();
    public void  eat(){//操作
        System.out.println("吃");
    }
    public  void sleep(){
        System.out.println("睡");
    }

    @Override
    public String toString() {
        return name+"\t"+age;
    }
}
